import { $post, $put } from "@src/assets/js/request"


export async function sendMessageRequest (
  caseid,
  receiverid,
  receiver,
  content,
  fileid
) {
  const res = await $post('/api/xapc/xd/imessage/sendMessage', {
    caseid,
    receiverid,
    receiver,
    content,
    fileid
  })
  return res.data
}

export async function addFriendRequest (caseid, friendAccountid, userRole, friendRole) {
  const res = await $put('/api/xapc/xd/imessage/addFriendship', {
    caseid,
    friend_accountid: friendAccountid,
    user_role: userRole,
    friend_role: friendRole
  })
  return res.data
}

export async function readRequest (caseid, senderid) {
  const res = await $put('/api/xapc/xd/imessage/readMessage', {
    caseid,
    senderid
  })
  return res.data
}

